﻿using Md.Api.Entity.DapperModels.MdDB;
using Md.Api.Model.Manage.MdArticleFieldExpansion.Request;
using Md.Dapper.Repositories.Md;

namespace Md.Api.Service.Manage.MdArticleFieldExpansion;
/// <summary>
/// 获取文章字段扩展列表服务
/// </summary>
public class GetMdArticleFieldExpansionListService : ApiBase<RequestGetMdArticleFieldExpansionListModel>
{
    /// <summary>
    /// 文章字段扩展仓储
    /// </summary>
    public MdArticleFieldExpansionRep mdArticleFieldExpansionRep { get; set; }
    /// <summary>
    /// 执行
    /// </summary>
    protected override void ExecuteMethod()
    {
        var model = new MdArticleFieldExpansionModel();

        model.ArticleId = Parameter.ArticleId;
        model.FieldName = Parameter.FieldName;
        model.FieldType = Parameter.FieldType;
        model.CategoryId = Parameter.CategoryId;
        model.Status = Parameter.Status;
        model.CreateBy = Parameter.CreateBy;
        model.UpdateBy = Parameter.UpdateBy;

        var res = mdArticleFieldExpansionRep.GetMdArticleFieldExpansionList(model, Parameter.OrderBy, Parameter.IsDesc);

        Result.Data = res;
    }
}

